package com.china08.yxyapi.schedule.huixue;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.china08.yxyapi.util.DateUtils;
import com.china08.yxyapi.util.RabbitMqSendUtil;
import com.china08.yxyapi.util.YxyScheduleRunnableUtil;

@Component
public class YxyHuixuePlanStatisticsTask {

    private static final Logger LOGGER = LoggerFactory.getLogger(YxyHuixuePlanStatisticsTask.class);

    /**
     * 每日终止成绩提升学习计划
     */
    @Scheduled(cron = "0 20 0 * * ?")
    public void resResourceForMonthTask() {
        String hostname = null;

        // ##
        // 检测定时任务是否可执行
        if (!YxyScheduleRunnableUtil.checkRunnable()) { return; }

        LOGGER.info("开始执行每日学习计划掌握度计算.运行地址：" + hostname);
        RabbitMqSendUtil.huixuePlanCheckDay(DateUtils.formatDate4(new Date()));
    }
}
